#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

static bool prime(uint64_t n) {
    if (n < 2)
        return false;
    if (n == 2)
        return true;
    if (n % 2 == 0)
        return false;

    for (uint64_t i = 3; i * i <= n; i += 2) {
        if (n % i == 0)
            return false;
    }

    return true;
}

int main() {
    vector<uint64_t> primes;
    for (int i = 0; i < 100'0000; ++i) {
        if (prime(i))
            primes.push_back(i);
    }

    vector<uint64_t> accumulates {0};
    for (int i = 0; i < primes.size(); ++i) 
        accumulates.push_back(primes[i] + accumulates[i]);

    uint64_t ans = 0;
    uint64_t len = 0;    
    for (auto i = 0; i + len < accumulates.size(); ++i) {
        for (auto j = accumulates.size() - 1; j - i > len; --j) {
            uint64_t tmp = accumulates[j] - accumulates[i];
            if (tmp % 2 == 0)
                continue;
            else if (tmp > primes.back())
                continue;
            else if (!binary_search(primes.begin(), primes.end(), tmp))
                continue;
            else {
                len = j - i;
                ans = tmp;
                cout << len << ' ' << ans << endl;
                break;
            }
        }
    }
}